package com.umgsai.thread.thread26;

public class ThreadB extends Thread {
	volatile private MyList myList;
	public ThreadB(MyList myList) {
		super();
		this.myList = myList;
	}
	@Override
	public void run() {
		try {
			while (true) {
//				Thread.sleep(100);
//				System.out.println("size=" + myList.size());
				if (myList.size() == 5) {
					System.out.println("==5了，要退出了");
					throw new InterruptedException();
				}
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
